package com.design.model;

/**
 * def
 *
 * @author lw
 * @date 2023/12/4 17:04
 **/
public class VisitorPatternExample {

    public static void main(String[] args) {
        Circle circle = new Circle(5);
        Rectangle rectangle = new Rectangle(4, 6);

        AreaCalculator areaCalculator = new AreaCalculator();
        circle.accept(areaCalculator);
        rectangle.accept(areaCalculator);

        System.out.println("Total area: " + areaCalculator.getArea());
    }
}
